//declare parameter pin
int ledLock=9;
int ledLamp=10;
int doorStatus=11;

void setup(){
  //setup input output
  Serial.begin(9600);
    //configure input/output
  pinMode(doorStatus,INPUT);
  pinMode(ledLock,OUTPUT);
  pinMode(ledLamp,OUTPUT);


}

void loop(){
  if (Serial.available()) {
  char checkRemote = Serial.read(); //input 'L' or 'U'
  switch (checkRemote) {
  case 'L':
  //if the door is lock
    if(digitalRead(doorStatus)==HIGH){
    digitalWrite(ledLock,HIGH);
    digitalWrite(ledLamp,HIGH);
    delay(1000);
    digitalWrite(ledLamp,LOW);
    }
    else{
         Serial.println("Door is open");
    }

  break;
  case 'U':

  if(digitalRead(doorStatus)==HIGH){
   digitalWrite(ledLock,LOW);
   digitalWrite(ledLamp,HIGH);
   delay(1000);
   digitalWrite(ledLamp,LOW);
   delay(1000);
   digitalWrite(ledLamp,HIGH);
   delay(1000);
   digitalWrite(ledLamp,LOW);
  }

  else{
    Serial.println("Door is open");
  }

   break;
  }
  }
}
